package com.cgwx.tmservice.convert;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import io.swagger.annotations.Api;

/**
 * @author GaoWei
 * @Date 2023/8/8 - 17:08
 */

@Api(tags = "读取Excel时，遥测原码值转换器")
public class TmOriginalConverter implements Converter {
    @Override
    public Class supportJavaTypeKey() {
        return null;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return null;
    }

    @Override
    public Object convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) {
        int tmOriginalType = 0;
        switch (cellData.toString())
        {
            case "无符号":
                tmOriginalType = 0;
                break;
            case "有符号":
                tmOriginalType = 1;
                break;
            case "补码":
                tmOriginalType = 2;
                break;
            case "反码":
                tmOriginalType = 3;
                break;
        }
        return tmOriginalType;
    }

    @Override
    public CellData convertToExcelData(Object o, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) {
        return null;
    }
}
